from machine import Pin
from neopixel import NeoPixel 
import time
import random

#1,2面的io定义

mian01 = Pin(13,Pin.OUT) ###定义引脚
m01 = NeoPixel(mian01,72)###定义灯的个数

#1,2面的io定义

mian23 = Pin(12,Pin.OUT) ###定义引脚
m23 = NeoPixel(mian23,72)###定义灯的个数

#1,2面的io定义

mian45 = Pin(14,Pin.OUT) ###定义引脚
m45 = NeoPixel(mian45,72)###定义灯的个数


#定义平面坐标系
def zb(x,y):
	zuobiao = x+y*6
	return zuobiao 

#定义反坐标
def fzb(fb):
	x = fb%6
	y = fb/6
	return [x,y]

#定义整个平面
body = []
for i in range(36):
	body.append((0,0,0))

#剩余空间
def sykj(parameter_list=[]):
	a = 0
	sy =[]
	for i in body:
		if i ==(0,0,0):
			sy.append(a)
		a = a + 1
	return sy 

#随机产生一个不重复的豆豆
def doudou(parameter_list=[]):
	a = 0 
	nb = 0
	colour = []
	while a == 0 :
		nb = random.getrandbits(30)%36
		a = parameter_list.count(nb)
	for i in range(3):
		colour.append(random.getrandbits(16)%50)
	colour = tuple(colour)
	body[nb] = colour
	for i in range(36):
		m23[i] = body[i]
	m23.write()

for i in range(36):
	pl = sykj(body)
	print(pl)
	doudou(pl)

